<template>
  <div class="personalized">
    <div class="personalized-top">
      <Title :subTitle="subTitle"></Title>
    </div>
    <div class="personalized-list">
      <div class="item" v-for="value in personalized" :key="value.id" @click="selectItem(value.id)">
        <img v-lazy="value.picUrl" :alt="value.copywriter">
        <p>
          {{ value.name }}
        </p>
      </div>
    </div>
  </div>
</template>

<script>
import Title from "../Title";

export default {
  props: {
    personalized: Array,
    subTitle: String,
    type: String
  },
  name: "Personalized",
  components: {
    Title
  },
  methods: {
    selectItem(id) {
      // console.log(id);
      // this.$router.push(`detail/${id}`)
      this.$emit('select', id, this.type)
    }
  }
}
</script>

<style scoped lang="scss">
@import "../../assets/css/variable";
@import "../../assets/css/mixin";

.personalized {
  @include bg_sub_color();

  .personalized-list {
    width: 100%;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;

    .item {
      width: 200px;
      padding: 20px 0;

      img {
        width: 100%;
        height: 200px;
        border-radius: 15px;
      }

      p {
        @include clamp(2);
        padding-top: 10px;
        @include font_size($font_medium);
        @include font-color();
        text-align: center;
      }
    }
  }
}
</style>
